package com.custom.action.joiner.interfaces;

import com.custom.comm.utils.lambda.SFunction;

import java.io.Serializable;

/**
 * sql 聚合函数
 * @author Xiao-Bai
 * @since 2023/5/1 22:20
 */
public interface SqlAggregateFunc<Children> extends Serializable {


    /**
     * sum
     */
    <Any> Children sum(boolean condition, SFunction<Any, ?> column);
    default <Any> Children sum(SFunction<Any, ?> column) {
        return sum(true, column);
    }

    <Any, Pro> Children sum(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children sum(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return sum(true, column, alias);
    }

    <Any> Children sumDistinct(boolean condition, SFunction<Any, ?> column);
    default <Any> Children sumDistinct(SFunction<Any, ?> column) {
        return sumDistinct(true, column);
    }

    <Any, Pro> Children sumDistinct(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children sumDistinct(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return sumDistinct(true, column, alias);
    }


    /**
     * avg
     */
    <Any> Children avg(boolean condition, SFunction<Any, ?> column);
    default <Any> Children avg(SFunction<Any, ?> column) {
        return avg(true, column);
    }

    <Any, Pro> Children avg(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children avg(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return avg(true, column, alias);
    }

    <Any> Children avgDistinct(boolean condition, SFunction<Any, ?> column);
    default <Any> Children avgDistinct(SFunction<Any, ?> column) {
        return avgDistinct(true, column);
    }

    <Any, Pro> Children avgDistinct(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children avgDistinct(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return avgDistinct(true, column, alias);
    }


    /**
     * count
     */
    <Any> Children count(boolean condition, SFunction<Any, ?> column);
    default <Any> Children count(SFunction<Any, ?> column) {
        return count(true, column);
    }

    <Any, Pro> Children count(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children count(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return count(true, column, alias);
    }

    <Any> Children countDistinct(boolean condition, SFunction<Any, ?> column);
    default <Any> Children countDistinct(SFunction<Any, ?> column) {
        return countDistinct(true, column);
    }

    <Any, Pro> Children countDistinct(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children countDistinct(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return countDistinct(true, column, alias);
    }


    /**
     * max
     */
    <Any> Children max(boolean condition, SFunction<Any, ?> column);
    default <Any> Children max(SFunction<Any, ?> column) {
        return max(true, column);
    }

    <Any, Pro> Children max(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children max(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return max(true, column, alias);
    }

    <Any> Children maxDistinct(boolean condition, SFunction<Any, ?> column);
    default <Any> Children maxDistinct(SFunction<Any, ?> column) {
        return maxDistinct(true, column);
    }

    <Any, Pro> Children maxDistinct(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children maxDistinct(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return maxDistinct(true, column, alias);
    }


    /**
     * min
     */
    <Any> Children min(boolean condition, SFunction<Any, ?> column);
    default <Any> Children min(SFunction<Any, ?> column) {
        return min(true, column);
    }

    <Any, Pro> Children min(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children min(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return min(true, column, alias);
    }

    <Any> Children minDistinct(boolean condition, SFunction<Any, ?> column);
    default <Any> Children minDistinct(SFunction<Any, ?> column) {
        return minDistinct(true, column);
    }

    <Any, Pro> Children minDistinct(boolean condition, SFunction<Any, ?> column, SFunction<Pro, ?> alias);
    default <Any, Pro> Children minDistinct(SFunction<Any, ?> column, SFunction<Pro, ?> alias) {
        return minDistinct(true, column, alias);
    }



}
